****This do-file contains code for the analyses in Appendix OF where we look at 
****the potential non-linearity of effects for the disagreement measures
****This is done by multipling the disagreement measure by itself in each model
****e.g. the "c.pdiff_avg##c.pdiff_avg entries
****results are written to file using the esttab function
***and plotted using combomarginsplot	
	
	
***Attitude Importance
	***Party Disagreement

	eststo clear
	eststo: regress samesex10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(pdiff_avg=(0(1)6)) saving(ss_pd_imp, replace)
		
		
	eststo: regress richtaxes10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
		margins, at(pdiff_avg=(0(1)6)) saving(rt_pd_imp, replace)
			
	eststo: regress drugs10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
		margins, at(pdiff_avg=(0(1)6)) saving(dr_pd_imp, replace)

	eststo: regress medic10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(med_pd_imp, replace)

	eststo: regress habeas10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(pdiff_avg=(0(1)6)) saving(hab_pd_imp, replace)

	eststo: regress phone10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(pdiff_avg=(0(1)6)) saving(pho_pd_imp, replace)

	eststo: regress illeg10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
		margins, at(pdiff_avg=(0(1)6)) saving(ill_pd_imp, replace)

	eststo: regress path10imp c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
		margins, at(pdiff_avg=(0(1)6)) saving(pat_pd_imp, replace)

	esttab using attimp_PD__diffsquared_withcontrols_age2.rtf, onecell label se ar2 star(+ 0.10 * 0.05 ** 0.01) addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).) nobaselevels
	
	combomarginsplot ss_pd_imp rt_pd_imp dr_pd_imp med_pd_imp hab_pd_imp pho_pd_imp  ill_pd_imp pat_pd_imp, ///
		labels("Same Sex Marriage Ban" "Taxing the Rich" "Paying Seniors Drugs" "Gov't Paying Medical Care" "Habeas Corpus Rights" "Court Order Wiretaps" "Ill. Imm Work Stay" "Path to Citizenship") ///
		by(_filenumber) scheme(s1mono) 
						
	**General Disagreement***
		

		eststo clear
		eststo: regress samesex10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
				margins, at(gendiff=(1(1)5)) saving(ss_gd_imp, replace)
				
		eststo: regress richtaxes10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
		margins, at(gendiff=(1(1)5)) saving(rt_gd_imp, replace)
	
		eststo: regress drugs10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
				margins, at(gendiff=(1(1)5)) saving(dr_gd_imp, replace)

		eststo: regress medic10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
				margins, at(gendiff=(1(1)5)) saving(med_gd_imp, replace)

		eststo: regress habeas10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
				margins, at(gendiff=(1(1)5)) saving(hab_gd_imp, replace)

		eststo: regress phone10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
				margins, at(gendiff=(1(1)5)) saving(pho_gd_imp, replace)

		eststo: regress illeg10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
				margins, at(gendiff=(1(1)5)) saving(ill_gd_imp, replace)

		eststo: regress path10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
				margins, at(gendiff=(1(1)5)) saving(pat_gd_imp, replace)

		esttab using attimp_gendiff_squared_withcontrols.rtf, onecell label se ar2 star(+ 0.10 * 0.05 ** 0.01) nobaselevels  addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).) 
		
		combomarginsplot ss_gd_imp rt_gd_imp dr_gd_imp med_gd_imp hab_gd_imp pho_gd_imp  ill_gd_imp pat_gd_imp, ///
		labels("Same Sex Marriage Ban" "Taxing the Rich" "Paying Seniors Drugs" "Gov't Paying Medical Care" "Habeas Corpus Rights" "Court Order Wiretaps" "Ill. Imm Work Stay" "Path to Citizenship") ///
		by(_filenumber) scheme(s1mono) 
						
							
							
*Extremity*		
	*Party Disagreement
			eststo clear
		eststo: regress samesex10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(ss_pd_imp, replace)
		eststo: regress richtaxes10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(rt_pd_imp, replace)
			
		eststo: regress drugs10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(dr_pd_imp, replace)

		eststo: regress medic10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(med_pd_imp, replace)

		eststo: regress habeas10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(hab_pd_imp, replace)

		eststo: regress phone10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(pho_pd_imp, replace)

		eststo: regress illeg10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(ill_pd_imp, replace)

		eststo: regress path10ext c.pdiff_avg##c.pdiff_avg c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(pdiff_avg=(0(1)6)) saving(pat_pd_imp, replace)
			
			esttab using attext_PDEX_squared_withcontrols.rtf, onecell label se ar2 star(+ 0.10 * 0.05 ** 0.01) addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).)
				
		combomarginsplot ss_pd_imp rt_pd_imp dr_pd_imp med_pd_imp hab_pd_imp pho_pd_imp  ill_pd_imp pat_pd_imp, ///
			labels("Same Sex Marriage Ban" "Taxing the Rich" "Paying Seniors Drugs" "Gov't Paying Medical Care" "Habeas Corpus Rights" "Court Order Wiretaps" "Ill. Imm Work Stay" "Path to Citizenship") ///
			by(_filenumber) scheme(s1mono) 
				
							
	*General Disagreement
		eststo clear
		eststo: regress samesex10ext c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(ss_gd_imp, replace)
		
		
		eststo: regress richtaxes10ext c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(rt_gd_imp, replace)
	
		eststo: regress drugs10ext c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(dr_gd_imp, replace)

		eststo: regress medic10ext c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(med_gd_imp, replace)

		eststo: regress habeas10ext c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(hab_gd_imp, replace)

		eststo: regress phone10ext c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(pho_gd_imp, replace)

		eststo: regress illeg10ext c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ  [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(ill_gd_imp, replace)

		eststo: regress path10imp c.gendiff##c.gendiff c.interest10 c.pid10 c.ideology10 i.gender c.age c.age#c.age c.educ c.income i.race c.network_genderh c.network_denom c.race_network c.network_size c.network_close c.network_interest c.network_educ [pweight = WGTL10]
			margins, at(gendiff=(1(1)5)) saving(pat_gd_imp, replace)
		
		esttab using attext_GD_squared_withcontrols.rtf, onecell label se ar2 star(+ 0.10 * 0.05 ** 0.01) addnotes(Results are from OLS models. Cell entries are unstandardized coefficients. Analyses are weighted (wgtL10).)
						
		combomarginsplot ss_gd_imp rt_gd_imp dr_gd_imp med_gd_imp hab_gd_imp pho_gd_imp  ill_gd_imp pat_gd_imp, ///
		labels("Same Sex Marriage Ban" "Taxing the Rich" "Paying Seniors Drugs" "Gov't Paying Medical Care" "Habeas Corpus Rights" "Court Order Wiretaps" "Ill. Imm Work Stay" "Path to Citizenship") ///
		by(_filenumber) scheme(s1mono) 
